﻿namespace HuanReZhanDataReceiver
{

    //由设备上报的数据
    public class UploadedData
    {
        /// <summary>
        /// equi：采集设备编号
        /// </summary>
        public string Equi { get; set; }

        /// <summary>
        /// battery：电池电压（V），电池供电型产品有此字段
        /// </summary>
        public double Battery { get; set; }

        /// <summary>
        /// switch: 摄像头电源的当前状态，0=OFF，1=ON
        /// </summary>
        public int Switch { get; set; }

        /// <summary>
        /// linked: 当前modbus连接当前状态，0=未连接（无响应或错误），1=已连接
        /// </summary>
        public int Linked { get; set; }

        /// <summary>
        /// x：x轴倾斜角度(°)
        /// </summary>
        public double X { get; set; }

        /// <summary>
        /// y：y轴倾斜角度(°)
        /// </summary>
        public double Y { get; set; }

        /// <summary>
        /// z：z轴倾斜角度(°)
        /// </summary>
        public double Z { get; set; }

        /// <summary>
        /// x_up：x轴倾斜角度正常范围上限(≥-180°)(≤180°)，都等于0则不判断报警，超出正常范围时，摄像头电源打开，恢复正常时电源关闭
        /// </summary>
        public double XUp { get; set; }

        /// <summary>
        /// y_up：y轴倾斜角度正常范围上限(≥-180°)(≤180°)
        /// </summary>
        public double YUp { get; set; }

        /// <summary>
        /// z_up：z轴倾斜角度正常范围上限(≥-180°)(≤180°)
        /// </summary>
        public double ZUp { get; set; }

        /// <summary>
        /// x_down：x轴倾斜角度正常范围下限(≥-180°)(≤180°)
        /// </summary>
        public double XDown { get; set; }

        /// <summary>
        /// y_down：y轴倾斜角度正常范围下限(≥-180°)(≤180°)
        /// </summary>
        public double YDown { get; set; }

        /// <summary>
        /// z_down：z轴倾斜角度正常范围下限(≥-180°)(≤180°)
        /// </summary>
        public double ZDown { get; set; }

        public override string ToString()
        {
            return $"Equi:{Equi},Battery:{Battery},Switch:{Switch},Linked:{Linked},X:{X},Y:{Y},Z:{Z},XUp:{XUp},YUp:{YUp},ZUp:{ZUp},XDown:{XDown},YDown:{YDown},ZDown:{ZDown}";
        }
    }

    public class CommandData
    {
        /// <summary>
        /// switch: 摄像头电源的控制状态，0=OFF，1=ON，非报警状态控制有效
        /// </summary>
        public int Switch { get; set; }

        /// <summary>
        /// UploadInterval: 采集终端上传数据的间隔时间(0-65535 秒)，为0时=不上传，UploadMode=1时无意义
        /// </summary>
        public int UploadInterval { get; set; }

        /// <summary>
        /// x_up：x轴倾斜角度正常范围上限(≥-180°)(≤180°)，都等于0则不判断报警，超出正常范围时，摄像头电源打开，恢复正常时电源关闭
        /// </summary>
        public double XUp { get; set; }

        /// <summary>
        /// y_up：y轴倾斜角度正常范围上限(≥-180°)(≤180°)
        /// </summary>
        public double YUp { get; set; }

        /// <summary>
        /// z_up：z轴倾斜角度正常范围上限(≥-180°)(≤180°)
        /// </summary>
        public double ZUp { get; set; }

        /// <summary>
        /// x_down：x轴倾斜角度正常范围下限(≥-180°)(≤180°)
        /// </summary>
        public double XDown { get; set; }

        /// <summary>
        /// y_down：y轴倾斜角度正常范围下限(≥-180°)(≤180°)
        /// </summary>
        public double YDown { get; set; }

        /// <summary>
        /// z_down：z轴倾斜角度正常范围下限(≥-180°)(≤180°)
        /// </summary>
        public double ZDown { get; set; }
    }

    public class CommandResponseData
    {
        /// <summary>
        /// result: 执行结果，"OK" 表示成功，"ERR" 表示错误
        /// </summary>
        public string Result { get; set; }
    }

    public class CommandInfo {
        public string CommandStr { get; set; }
        public string CommandId { get; set; }  
    }
}
